<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
class Export_csv_m extends CI_Model{
    public function __construct() {
        parent::__construct();
        $this->load->database();
    }
    public function insert_to_f1_q1($id_question,$qs,$s1,$s2,$s3,$s4,$s5,$s6,$an_ks,$sc)
    {
        $data = array(  
            'id_question'=>$id_question,                  
            'qs'=>$qs,
            's1'=>$s1,
            's2'=>$s2,
            's3'=>$s3,
            's4'=>$s4,
            's5'=>$s5,
            's6'=>$s6,
            'an_ks'=>$an_ks,
            'sc'=>$sc
            
                     );
        $this->db->insert('f1_q1',$data);
    }
    public function update_f1_q1($id_question,$qs,$s1,$s2,$s3,$s4,$s5,$s6,$an_ks,$sc)
    {
        $data = array(                  
            'qs'=>$qs,
            's1'=>$s1,
            's2'=>$s2,
            's3'=>$s3,
            's4'=>$s4,
            's5'=>$s5,
            's6'=>$s6,
            'an_ks'=>$an_ks,
            'sc'=>$sc
            
                     );
        $this->db->where('id_question',$id_question);
        $this->db->update('f1_q1',$data);
    }
    public function insert_to_f2_q1($id_question,$qs,$s1,$s2,$s3,$s4,$s5,$s6,$an_ks,$sc)
    {
        $data = array(  
            'id_question'=>$id_question,                  
            'qs'=>$qs,
            's1'=>$s1,
            's2'=>$s2,
            's3'=>$s3,
            's4'=>$s4,
            's5'=>$s5,
            's6'=>$s6,
            'an_ks'=>$an_ks,
            'sc'=>$sc
            
                     );
        $this->db->insert('f2_q1',$data);
    }
    public function update_f2_q1($id_question,$qs,$s1,$s2,$s3,$s4,$s5,$s6,$an_ks,$sc)
    {
        $data = array(                   
            'qs'=>$qs,
            's1'=>$s1,
            's2'=>$s2,
            's3'=>$s3,
            's4'=>$s4,
            's5'=>$s5,
            's6'=>$s6,
            'an_ks'=>$an_ks,
            'sc'=>$sc
            
                     );
        $this->db->where('id_question', $id_question);
        $this->db->update('f2_q1', $data);
    }
    public function insert_to_f1_q2($id_question,$qs,$s1,$s2,$s3,$s4,$s5,$s6,$an_kso,$sc)
    {
        $data = array(  
            'id_question'=>$id_question,                  
            'qs'=>$qs,
            's1'=>$s1,
            's2'=>$s2,
            's3'=>$s3,
            's4'=>$s4,
            's5'=>$s5,
            's6'=>$s6,
            'an_kso'=>$an_kso,
            'sc'=>$sc
            
                     );
        $this->db->insert('f1_q2',$data);
    }
    public function update_f1_q2($id_question,$qs,$s1,$s2,$s3,$s4,$s5,$s6,$an_kso,$sc)
    {
        $data = array(  
                             
            'qs'=>$qs,
            's1'=>$s1,
            's2'=>$s2,
            's3'=>$s3,
            's4'=>$s4,
            's5'=>$s5,
            's6'=>$s6,
            'an_kso'=>$an_kso,
            'sc'=>$sc
            
                     );
        $this->db->where('id_question',$id_question);
        $this->db->update('f1_q2',$data);
    }
    public function insert_to_f2_q2($id_question,$qs,$s1,$s2,$s3,$s4,$s5,$s6,$an1_ksa,$an2_ksa,$an3_ksa,$sc1,$sc2,$sc3)
    {
        $data = array(  
            'id_question'=>$id_question,                  
            'qs'=>$qs,
            's1'=>$s1,
            's2'=>$s2,
            's3'=>$s3,
            's4'=>$s4,
            's5'=>$s5,
            's6'=>$s6,
            'an1_ksa'=>$an1_ksa,
            'an2_ksa'=>$an2_ksa,
            'an3_ksa'=>$an3_ksa,
            'sc1'=>$sc1,
            'sc2'=>$sc2,
            'sc3'=>$sc3
            
                     );
        $this->db->insert('f2_q2',$data);
    }
    public function update_f2_q2($id_question,$qs,$s1,$s2,$s3,$s4,$s5,$s6,$an1_ksa,$an2_ksa,$an3_ksa,$sc1,$sc2,$sc3)
    {
        $data = array(                   
            'qs'=>$qs,
            's1'=>$s1,
            's2'=>$s2,
            's3'=>$s3,
            's4'=>$s4,
            's5'=>$s5,
            's6'=>$s6,
            'an1_ksa'=>$an1_ksa,
            'an2_ksa'=>$an2_ksa,
            'an3_ksa'=>$an3_ksa,
            'sc1'=>$sc1,
            'sc2'=>$sc2,
            'sc3'=>$sc3
            
                     );
        $this->db->where('id_question', $id_question);
        $this->db->update('f2_q2', $data);
    }
     public function insert_to_f1_q3($id_question,$qs,$s1,$s2,$s3,$s4,$s5,$s6,$an_ksa,$sc)
    {
        $data = array(  
            'id_question'=>$id_question,                  
            'qs'=>$qs,
            's1'=>$s1,
            's2'=>$s2,
            's3'=>$s3,
            's4'=>$s4,
            's5'=>$s5,
            's6'=>$s6,
            'an_ksa'=>$an_ksa,
            'sc'=>$sc
            
                     );
        $this->db->insert('f1_q3',$data);
    }
    public function update_f1_q3($id_question,$qs,$s1,$s2,$s3,$s4,$s5,$s6,$an_ksa,$sc)
    {
        $data = array(  
                
            'qs'=>$qs,
            's1'=>$s1,
            's2'=>$s2,
            's3'=>$s3,
            's4'=>$s4,
            's5'=>$s5,
            's6'=>$s6,
            'an_ksa'=>$an_ksa,
            'sc'=>$sc
            
                     );
        $this->db->where('id_question',$id_question);
        $this->db->update('f1_q3',$data);
    }
     public function insert_to_f2_q3($id_question,$qs,$s1,$s2,$s3,$s4,$s5,$s6,$an_ks,$sc)
    {
        $data = array(  
            'id_question'=>$id_question,                  
            'qs'=>$qs,
            's1'=>$s1,
            's2'=>$s2,
            's3'=>$s3,
            's4'=>$s4,
            's5'=>$s5,
            's6'=>$s6,
            'an_ks'=>$an_ks,
            'sc'=>$sc
            
                     );
        $this->db->insert('f2_q3',$data);
    }
     public function update_f2_q3($id_question,$qs,$s1,$s2,$s3,$s4,$s5,$s6,$an_ks,$sc)
    {
        $data = array(                    
            'qs'=>$qs,
            's1'=>$s1,
            's2'=>$s2,
            's3'=>$s3,
            's4'=>$s4,
            's5'=>$s5,
            's6'=>$s6,
            'an_ks'=>$an_ks,
            'sc'=>$sc
            
                     );
        $this->db->where('id_question', $id_question);
        $this->db->update('f2_q3', $data);
    }
    
    public function insert_to_f1_q4($id_question,$qw,$wr1,$an1_kw,$an2_kw,$sc_an1,$sc_an2)
    {
        $data = array(  
            'id_question'=>$id_question,                  
            'qw'=>$qw,
            'wr1'=>$wr1,
            'an1_kw'=>$an1_kw,
            'an2_kw'=>$an2_kw,
            'sc_an1'=>$sc_an1,
            'sc_an2'=>$sc_an2,
            
                     );
        $this->db->insert('f1_q4',$data);
    }
    public function update_f1_q4($id_question,$qw,$wr1,$an1_kw,$an2_kw,$sc_an1,$sc_an2)
    {
        $data = array(  
                              
            'qw'=>$qw,
            'wr1'=>$wr1,
            'an1_kw'=>$an1_kw,
            'an2_kw'=>$an2_kw,
            'sc_an1'=>$sc_an1,
            'sc_an2'=>$sc_an2,
            
                     );
        $this->db->where('id_question',$id_question);
        $this->db->update('f1_q4',$data);
    }
    public function insert_to_f2_q4($id_question,$qw,$wr,$an_kwa,$sc)
    {
        $data = array(  
            'id_question'=>$id_question,                  
            'qw'=>$qw,
            'wr'=>$wr,
            'an_kwa'=>$an_kwa,
            'sc'=>$sc
                     );
        $this->db->insert('f2_q4',$data);
    }
    public function update_f2_q4($id_question,$qw,$wr,$an_kwa,$sc)
    {
        $data = array(                    
            'qw'=>$qw,
            'wr'=>$wr,
            'an_kwa'=>$an_kwa,
            'sc'=>$sc
                     );
        $this->db->where('id_question', $id_question);
        $this->db->update('f2_q4', $data);
    }
    
    public function insert_to_f1_q5($id_question,$qs,$s1,$s2,$s3,$s4,$s5,$s6,$s7,
            $an1_ks,$an2_ks,$an3_ksa,$an4_kso,$sc1,$sc2,$sc3,$sc4)
    {
        $data = array(  
            'id_question'=>$id_question,                  
            'qs'=>$qs,
            's1'=>$s1,
            's2'=>$s2,
            's3'=>$s3,
            's4'=>$s4,
            's5'=>$s5,
            's6'=>$s6,
            's7'=>$s7,
            'an1_ks'=>$an1_ks,
            'an2_ks'=>$an2_ks,
            'an3_ksa'=>$an3_ksa,
            'an4_kso'=>$an4_kso,
            'sc1'=>$sc1,
            'sc2'=>$sc2,
            'sc3'=>$sc3,
            'sc4'=>$sc4
            
                     );
        $this->db->insert('f1_q5',$data);
    }
    public function update_f1_q5($id_question,$qs,$s1,$s2,$s3,$s4,$s5,$s6,$s7,
            $an1_ks,$an2_ks,$an3_ksa,$an4_kso,$sc1,$sc2,$sc3,$sc4)
    {
        $data = array(  
            'id_question'=>$id_question,                  
            'qs'=>$qs,
            's1'=>$s1,
            's2'=>$s2,
            's3'=>$s3,
            's4'=>$s4,
            's5'=>$s5,
            's6'=>$s6,
            's7'=>$s7,
            'an1_ks'=>$an1_ks,
            'an2_ks'=>$an2_ks,
            'an3_ksa'=>$an3_ksa,
            'an4_kso'=>$an4_kso,
            'sc1'=>$sc1,
            'sc2'=>$sc2,
            'sc3'=>$sc3,
            'sc4'=>$sc4
            
                     );
        $this->db->insert('f1_q5',$data);
    }
    public function insert_to_f2_q5($id_question,$qs,$s1,$s2,$s3,$s4,$s5,$s6,$s7,$s8,
            $an1_ksa,$an2_ksa,$an3_ksa,$an4_ksa,$an5_ksa,$sc1,$sc2,$sc3,$sc4,$sc5)
    {
        $data = array(  
            'id_question'=>$id_question,               
            'qs'=>$qs,
            's1'=>$s1,
            's2'=>$s2,
            's3'=>$s3,
            's4'=>$s4,
            's5'=>$s5,
            's6'=>$s6,
            's7'=>$s7,
            's8'=>$s8,
            'an1_ksa'=>$an1_ksa,
            'an2_ksa'=>$an2_ksa,
            'an3_ksa'=>$an3_ksa,
            'an4_ksa'=>$an4_ksa,
            'an5_ksa'=>$an5_ksa,
            'sc1'=>$sc1,
            'sc2'=>$sc2,
            'sc3'=>$sc3,
            'sc4'=>$sc4,
            'sc5'=>$sc5
            
                     );
        $this->db->insert('f2_q5',$data);
    }
    public function update_f2_q5($id_question,$qs,$s1,$s2,$s3,$s4,$s5,$s6,$s7,$s8,
            $an1_ksa,$an2_ksa,$an3_ksa,$an4_ksa,$an5_ksa,$sc1,$sc2,$sc3,$sc4,$sc5)
    {
        $data = array(                    
            'qs'=>$qs,
            's1'=>$s1,
            's2'=>$s2,
            's3'=>$s3,
            's4'=>$s4,
            's5'=>$s5,
            's6'=>$s6,
            's7'=>$s7,
            's8'=>$s8,
            'an1_ksa'=>$an1_ksa,
            'an2_ksa'=>$an2_ksa,
            'an3_ksa'=>$an3_ksa,
            'an4_ksa'=>$an4_ksa,
            'an5_ksa'=>$an5_ksa,
            'sc1'=>$sc1,
            'sc2'=>$sc2,
            'sc3'=>$sc3,
            'sc4'=>$sc4,
            'sc5'=>$sc5
            
                     );
        $this->db->where('id_question', $id_question);
        $this->db->update('f2_q5', $data);
    }
    
    public function insert_to_f1_q6($id_question,$qw,$wr1,$wr2,$wr3,$wr4,$wr5,$wr6,$wr7,$wr8,$wr9,$wr10,
            $an1_kwpo,$an2_kwp,$an3_kwpo,$an4_kwpo,$an5_kwp,$an6_kwp,$an7_kwp,$an8_kwp,$an9_kwp,$an10_kwp,
            $anc,$sc1,$sc2,$sc3,$sc4,$sc5,$sc6,$sc7,$sc8,$sc9,$sc10)
    {
        $data = array(  
            'id_question'=>$id_question,                  
            'qw'=>$qw,
            'wr1'=>$wr1,
            'wr2'=>$wr2,
            'wr3'=>$wr3,
            'wr4'=>$wr4,
            'wr5'=>$wr5,
            'wr6'=>$wr6,
            'wr7'=>$wr7,
            'wr8'=>$wr8,
            'wr9'=>$wr9,
            'wr10'=>$wr10,
            'an1_kwpo'=>$an1_kwpo,
            'an2_kwp'=>$an2_kwp,
            'an3_kwpo'=>$an3_kwpo,
            'an4_kwpo'=>$an4_kwpo,
            'an5_kwp'=>$an5_kwp,
            'an6_kwp'=>$an6_kwp,
            'an7_kwp'=>$an7_kwp,
            'an8_kwp'=>$an8_kwp,
            'an9_kwp'=>$an9_kwp,
            'an10_kwp'=>$an10_kwp,
            'anc'=>$anc,
            'sc1'=>$sc1,
            'sc2'=>$sc2,
            'sc3'=>$sc3,
            'sc4'=>$sc4,
            'sc5'=>$sc5,
            'sc6'=>$sc6,
            'sc7'=>$sc7,
            'sc8'=>$sc8,
            'sc9'=>$sc9,
            'sc10'=>$sc10,
            
                     );
        $this->db->insert('f1_q6',$data);
    }
    public function update_f1_q6($id_question,$qw,$wr1,$wr2,$wr3,$wr4,$wr5,$wr6,$wr7,$wr8,$wr9,$wr10,
            $an1_kwpo,$an2_kwp,$an3_kwpo,$an4_kwpo,$an5_kwp,$an6_kwp,$an7_kwp,$an8_kwp,$an9_kwp,$an10_kwp,
            $anc,$sc1,$sc2,$sc3,$sc4,$sc5,$sc6,$sc7,$sc8,$sc9,$sc10)
    {
        $data = array(  
                            
            'qw'=>$qw,
            'wr1'=>$wr1,
            'wr2'=>$wr2,
            'wr3'=>$wr3,
            'wr4'=>$wr4,
            'wr5'=>$wr5,
            'wr6'=>$wr6,
            'wr7'=>$wr7,
            'wr8'=>$wr8,
            'wr9'=>$wr9,
            'wr10'=>$wr10,
            'an1_kwpo'=>$an1_kwpo,
            'an2_kwp'=>$an2_kwp,
            'an3_kwpo'=>$an3_kwpo,
            'an4_kwpo'=>$an4_kwpo,
            'an5_kwp'=>$an5_kwp,
            'an6_kwp'=>$an6_kwp,
            'an7_kwp'=>$an7_kwp,
            'an8_kwp'=>$an8_kwp,
            'an9_kwp'=>$an9_kwp,
            'an10_kwp'=>$an10_kwp,
            'anc'=>$anc,
            'sc1'=>$sc1,
            'sc2'=>$sc2,
            'sc3'=>$sc3,
            'sc4'=>$sc4,
            'sc5'=>$sc5,
            'sc6'=>$sc6,
            'sc7'=>$sc7,
            'sc8'=>$sc8,
            'sc9'=>$sc9,
            'sc10'=>$sc10,
            
                     );
        $this->db->where('id_question',$id_question);
        $this->db->update('f1_q6',$data);
    }
    public function insert_to_f2_q6($id_question,$qw,$wr,$ins,$sc)
    {
        $data = array(  
            'id_question'=>$id_question,                  
            'qw'=>$qw,
            'wr'=>$wr,           
            'ins'=>$ins,
            'sc'=>$sc
            
                     );
        $this->db->insert('f2_q6',$data);
    }
    public function update_f2_q6($id_question,$qw,$wr,$ins,$sc)
    {
        $data = array(                   
            'qw'=>$qw,
            'wr'=>$wr,           
            'ins'=>$ins,
            'sc'=>$sc
            
                     );
        $this->db->where('id_question', $id_question);
        $this->db->update('f2_q6', $data);
    }
    
    public function insert_to_f1_q7($id_question,$qw,$wr1,$wr2,$wr3,$wr4,$wr5,$wr6,$wr7,$wr8,$wr9,$wr10,
            $an1_kwp,$an2_kwp,$an3_kwp,$an4_kwp,$an5_kwp,$an6_kwp,$an7_kwp,$an8_kwp,$an9_kwp,$an10_kwp,
            $anc,$sc1,$sc2,$sc3,$sc4,$sc5,$sc6,$sc7,$sc8,$sc9,$sc10)
    {
        $data = array(  
            'id_question'=>$id_question,                  
            'qw'=>$qw,
            'wr1'=>$wr1,
            'wr2'=>$wr2,
            'wr3'=>$wr3,
            'wr4'=>$wr4,
            'wr5'=>$wr5,
            'wr6'=>$wr6,
            'wr7'=>$wr7,
            'wr8'=>$wr8,
            'wr9'=>$wr9,
            'wr10'=>$wr10,
            'an1_kwp'=>$an1_kwp,
            'an2_kwp'=>$an2_kwp,
            'an3_kwp'=>$an3_kwp,
            'an4_kwp'=>$an4_kwp,
            'an5_kwp'=>$an5_kwp,
            'an6_kwp'=>$an6_kwp,
            'an7_kwp'=>$an7_kwp,
            'an8_kwp'=>$an8_kwp,
            'an9_kwp'=>$an9_kwp,
            'an10_kwp'=>$an10_kwp,
            'anc'=>$anc,
            'sc1'=>$sc1,
            'sc2'=>$sc2,
            'sc3'=>$sc3,
            'sc4'=>$sc4,
            'sc5'=>$sc5,
            'sc6'=>$sc6,
            'sc7'=>$sc7,
            'sc8'=>$sc8,
            'sc9'=>$sc9,
            'sc10'=>$sc10
            
                     );
        $this->db->insert('f1_q7',$data);
    }
    public function update_f1_q7($id_question,$qw,$wr1,$wr2,$wr3,$wr4,$wr5,$wr6,$wr7,$wr8,$wr9,$wr10,
            $an1_kwp,$an2_kwp,$an3_kwp,$an4_kwp,$an5_kwp,$an6_kwp,$an7_kwp,$an8_kwp,$an9_kwp,$an10_kwp,
            $anc,$sc1,$sc2,$sc3,$sc4,$sc5,$sc6,$sc7,$sc8,$sc9,$sc10)
    {
        $data = array(  
                              
            'qw'=>$qw,
            'wr1'=>$wr1,
            'wr2'=>$wr2,
            'wr3'=>$wr3,
            'wr4'=>$wr4,
            'wr5'=>$wr5,
            'wr6'=>$wr6,
            'wr7'=>$wr7,
            'wr8'=>$wr8,
            'wr9'=>$wr9,
            'wr10'=>$wr10,
            'an1_kwp'=>$an1_kwp,
            'an2_kwp'=>$an2_kwp,
            'an3_kwp'=>$an3_kwp,
            'an4_kwp'=>$an4_kwp,
            'an5_kwp'=>$an5_kwp,
            'an6_kwp'=>$an6_kwp,
            'an7_kwp'=>$an7_kwp,
            'an8_kwp'=>$an8_kwp,
            'an9_kwp'=>$an9_kwp,
            'an10_kwp'=>$an10_kwp,
            'anc'=>$anc,
            'sc1'=>$sc1,
            'sc2'=>$sc2,
            'sc3'=>$sc3,
            'sc4'=>$sc4,
            'sc5'=>$sc5,
            'sc6'=>$sc6,
            'sc7'=>$sc7,
            'sc8'=>$sc8,
            'sc9'=>$sc9,
            'sc10'=>$sc10
            
                     );
        $this->db->where('id_question',$id_question);
        $this->db->update('f1_q7',$data);
    }
    public function insert_to_f2_q7($id_question,$qw,$wr,
            $an1_kwpo,$an2_kwp,$an3_kwp,$an4_kwp,$an5_kwp,$an6_kwp,$an7_kwp,$an8_kwp,$an9_kwp,$an10_kwp,$ins,
            $sc1,$sc2, $sc3,$sc4,$sc5,$sc6,$sc7,$sc8,$sc9,$sc10,$sc11)
    {
        $data = array(  
            'id_question'=>$id_question,                  
            'qw'=>$qw,
            'wr'=>$wr,
            'an1_kwpo'=>$an1_kwpo,
            'an2_kwp'=>$an2_kwp,
            'an3_kwp'=>$an3_kwp,
            'an4_kwp'=>$an4_kwp,
            'an5_kwp'=>$an5_kwp,
            'an6_kwp'=>$an6_kwp,
            'an7_kwp'=>$an7_kwp,
            'an8_kwp'=>$an8_kwp,
            'an9_kwp'=>$an9_kwp,
            'an10_kwp'=>$an10_kwp,
            'ins'=>$ins,
            'sc1'=>$sc1,
            'sc2'=>$sc2,
            'sc3'=>$sc3,
            'sc4'=>$sc4,
            'sc5'=>$sc5,
            'sc6'=>$sc6,
            'sc7'=>$sc7,
            'sc8'=>$sc8,
            'sc9'=>$sc9,
            'sc10'=>$sc10,
            'sc11'=>$sc11
            
                     );
        $this->db->insert('f2_q7',$data);
    }
     public function update_f2_q7($id_question,$qw,$wr,
            $an1_kwpo,$an2_kwp,$an3_kwp,$an4_kwp,$an5_kwp,$an6_kwp,$an7_kwp,$an8_kwp,$an9_kwp,$an10_kwp,$ins,
            $sc1,$sc2, $sc3,$sc4,$sc5,$sc6,$sc7,$sc8,$sc9,$sc10,$sc11)
    {
        $data = array(                    
            'qw'=>$qw,
            'wr'=>$wr,
            'an1_kwpo'=>$an1_kwpo,
            'an2_kwp'=>$an2_kwp,
            'an3_kwp'=>$an3_kwp,
            'an4_kwp'=>$an4_kwp,
            'an5_kwp'=>$an5_kwp,
            'an6_kwp'=>$an6_kwp,
            'an7_kwp'=>$an7_kwp,
            'an8_kwp'=>$an8_kwp,
            'an9_kwp'=>$an9_kwp,
            'an10_kwp'=>$an10_kwp,
            'ins'=>$ins,
            'sc1'=>$sc1,
            'sc2'=>$sc2,
            'sc3'=>$sc3,
            'sc4'=>$sc4,
            'sc5'=>$sc5,
            'sc6'=>$sc6,
            'sc7'=>$sc7,
            'sc8'=>$sc8,
            'sc9'=>$sc9,
            'sc10'=>$sc10,
            'sc11'=>$sc11
            
                     );
        $this->db->where('id_question', $id_question);
        $this->db->update('f2_q7', $data);
    }
    
    public function insert_to_f2_q8($id_question,$qw,$wr1,$wr2,$wr3,
            $an1_kwpo,$an2_kwpo,$an3_kwpo,$an4_kwpo,
            $anc,$ins,$sc1,$sc2,$sc3,$sc4,$sc5)
    {
        $data = array(  
            'id_question'=>$id_question,                  
            'qw'=>$qw,
            'wr1'=>$wr1,
            'wr2'=>$wr2,
            'wr3'=>$wr3,
            'an1_kwpo'=>$an1_kwpo,
            'an2_kwpo'=>$an2_kwpo,
            'an3_kwpo'=>$an3_kwpo,
            'an4_kwpo'=>$an4_kwpo,
            'anc'=>$anc,
            'ins'=>$ins,
            'sc1'=>$sc1,
            'sc2'=>$sc2,
            'sc3'=>$sc3,
            'sc4'=>$sc4,
            'sc5'=>$sc5,
            
                     );
        $this->db->insert('f2_q8',$data);
    }
    public function update_f2_q8($id_question,$qw,$wr1,$wr2,$wr3,
            $an1_kwpo,$an2_kwpo,$an3_kwpo,$an4_kwpo,
            $anc,$ins,$sc1,$sc2,$sc3,$sc4,$sc5)
    {
        $data = array(                   
            'qw'=>$qw,
            'wr1'=>$wr1,
            'wr2'=>$wr2,
            'wr3'=>$wr3,
            'an1_kwpo'=>$an1_kwpo,
            'an2_kwpo'=>$an2_kwpo,
            'an3_kwpo'=>$an3_kwpo,
            'an4_kwpo'=>$an4_kwpo,
            'anc'=>$anc,
            'ins'=>$ins,
            'sc1'=>$sc1,
            'sc2'=>$sc2,
            'sc3'=>$sc3,
            'sc4'=>$sc4,
            'sc5'=>$sc5,
            
                     );
            $this->db->where('id_question', $id_question);
            $this->db->update('f2_q8', $data);
    }

    public function insert_to_x1_q($id_question,$qs,$q_type,$s1,$s2,$s3,$s4,
            $an1_ks,$an2_ks,$an3_ks,$an4_ks,$sc1,$sc2,$sc3,$sc4)
    {
        $data = array(  
            'id_question'=>$id_question,                  
            'qs'=>$qs,
            'q_type'=>$q_type,
            's1'=>$s1,
            's2'=>$s2,
            's3'=>$s3,
            's4'=>$s4,
            'an1_ks'=>$an1_ks,
            'an2_ks'=>$an2_ks,
            'an3_ks'=>$an3_ks,
            'an4_ks'=>$an4_ks,
            'sc1'=>$sc1,
            'sc2'=>$sc2,
            'sc3'=>$sc3,
            'sc4'=>$sc4
            
                     );
        $this->db->insert('x1_q',$data);
    }
     public function insert_to_x2_q($id_question,$q_type,$qs,$s1,$s2,$s3,$s4,$s5,$s6,$TRAP,
            $an_ks,$sc)
    {
        $data = array(  
            'id_question'=>$id_question,                  
            'q_type'=>$q_type,
            'qs'=>$qs,
            's1'=>$s1,
            's2'=>$s2,
            's3'=>$s3,
            's4'=>$s4,
            's5'=>$s5,
            's6'=>$s6,
            'TRAP'=>$TRAP,
            'an_ks'=>$an_ks,
            'sc'=>$sc
            
                     );
        $this->db->insert('x2_q',$data);
    }
    public function insert_to_x3_q($id_question,$q_type,$qs,$s1,$s2,$s3,$s4,$s5,$s6,$TM,
            $an_ks,$sc)
    {
        $data = array(  
            'id_question'=>$id_question,                  
            'q_type'=>$q_type,
            'qs'=>$qs,
            's1'=>$s1,
            's2'=>$s2,
            's3'=>$s3,
            's4'=>$s4,
            's5'=>$s5,
            's6'=>$s6,
            'TM'=>$TM,
            'an_ks'=>$an_ks,
            'sc'=>$sc
            
                     );
        $this->db->insert('x3_q',$data);
    }
    public function insert_to_compare($q,$id_question)
    {
        $data = array(  
            'q'=>$q,                  
            'id_question'=>$id_question
                    );
        $this->db->insert('compare',$data);
    }
    public function update_compare($q,$id_question)
    {
        $data = array(                 
            'id_question'=>$id_question
                    );
        $this->db->where('q', $q);
        $this->db->update('compare', $data);
    }
    public function check_question($id_question,$tabletype)
    {
        $this->db->select('*');
        $this->db->from($tabletype);
        $this->db->where('id_question',$id_question);
        $query=$this->db->get();
        if($query->num_rows()>0)
        {
            return 0;
        }
        else
            return 1;
    }
    public function check_question_compare($id_question,$tabletype)
    {
        $this->db->select('*');
        $this->db->from('compare');
        $this->db->where('id_question',$id_question);
        $this->db->where('q',$tabletype);
        $query=$this->db->get();
        if($query->num_rows()>0)
        {
            return 0;
        }
        else
            return 1;
    }
    public function update_csv($id,$name,$link){
        $data = array( 'name'=>$name,                   
                        'link'=>$link
                );
        $this->db->where('id_csv', $id);
        $this->db->update('csv', $data);
     }
    public function update_x1_q($id_question,$qs,$s1,$s2,$s3,$s4,
            $an1_ks,$an2_ks,$an3_ks,$an4_ks,$sc1,$sc2,$sc3,$sc4)
    {
        $data = array( 'qs'=>$qs,                   
                        's1'=>$s1,
            's2'=>$s2,
            's3'=>$s3,
            's4'=>$s4,
            'an1_ks'=>$an1_ks,
            'an2_ks'=>$an2_ks,
            'an3_ks'=>$an3_ks,
            'an4_ks'=>$an4_ks,
            'sc1'=>$sc1,
            'sc2'=>$sc2,
            'sc3'=>$sc3,
            'sc4'=>$sc4
            
                );
        $this->db->where('id_question', $id_question);
        $this->db->update('x1_q', $data);
    }
    public function update_x2_q($id_question,$qs,$s1,$s2,$s3,$s4,$s5,$s6,$TRAP,
            $an_ks,$sc)
    {
        $data = array(  
            'qs'=>$qs,
            's1'=>$s1,
            's2'=>$s2,
            's3'=>$s3,
            's4'=>$s4,
            's5'=>$s5,
            's6'=>$s6,
            'TRAP'=>$TRAP,
            'an_ks'=>$an_ks,
            'sc'=>$sc
            
                     );
        $this->db->where('id_question', $id_question);
        $this->db->update('x2_q', $data);
    }
    public function update_x3_q($id_question,$qs,$s1,$s2,$s3,$s4,$s5,$s6,$TM,
            $an_ks,$sc)
    {
        $data = array(  
            'qs'=>$qs,
            's1'=>$s1,
            's2'=>$s2,
            's3'=>$s3,
            's4'=>$s4,
            's5'=>$s5,
            's6'=>$s6,
            'TM'=>$TM,
            'an_ks'=>$an_ks,
            'sc'=>$sc
            
                     );
        $this->db->where('id_question', $id_question);
        $this->db->update('x3_q', $data);
    }
    public function select_x1_q($tabletype)
    {
        $this->db->select('*');
        $this->db->from($tabletype);
        $query=$this->db->get();
        return $query;
    }
    public function select_x1_q_content($tabletype,$id_question)
    {
        $this->db->select('*');
        $this->db->from($tabletype);
        $this->db->where('id_question',$id_question);
        $query=$this->db->get();
        return $query;
    }
    public function check_submit_x1($id_question,$id_te,$test_id)
    {
        $this->db->select('*');
        $this->db->from('qsubmit');
        $this->db->where('id_question',$id_question);
        $this->db->where('id_te',$id_te);
        $this->db->where('test_id',$test_id);
        $query=$this->db->get();
        return $query;
    }
    public function update_submit_x1($id_te,$id_qsub,$sub_an,$test_id)
    {
        $update_submit=array(
            'sub_an'=>$sub_an

        );
        $updatesubmit=$this->db->update('qsubmit',$update_submit,array('id_te'=>$id_te,'id_qsub'=>$id_qsub,'test_id'=>$test_id));
        return $updatesubmit;

    }
    public function insert_answer_ques1_x1($id_te,$id_question,$sub_ans,$test_id,$id_mg)
    {
        $data = array(  
            'id_te'=>$id_te,                  
            'id_question'=>$id_question,
            'sub_an'=>$sub_ans,
                'test_id'=>$test_id,
            'id_mg'=>$id_mg
                    );
        $this->db->insert('qsubmit',$data);
    }
    public function insert_answer_ques1_x1_tester($id_te,$id_question,$sub_ans,$test_id,$id_mg,$date_test)
    {
        $data = array(  
            'id_te'=>$id_te,                  
            'id_question'=>$id_question,
            'sub_an'=>$sub_ans,
                'test_id'=>$test_id,
            'id_mg'=>$id_mg,
            'date_test'=>$date_test
                    );
        $this->db->insert('qsubmit',$data);
    }
    public function insert_answer_ques($id_te,$id_question,$sub_ans,$test_id,$id_mg,$sub_time)
    {
        $data = array(  
            'id_te'=>$id_te,                  
            'id_question'=>$id_question,
            'sub_an'=>$sub_ans,
                'test_id'=>$test_id,
            'id_mg'=>$id_mg,
            'sub_time'=>$sub_time
                    );
        $this->db->insert('qsubmit',$data);
    }
    public function insert_answer_ques_tester($id_te,$id_question,$sub_ans,$test_id,$id_mg,$sub_time,$date_test)
    {
        $data = array(  
            'id_te'=>$id_te,                  
            'id_question'=>$id_question,
            'sub_an'=>$sub_ans,
                'test_id'=>$test_id,
            'id_mg'=>$id_mg,
            'sub_time'=>$sub_time,
            'date_test'=>$date_test
                    );
        $this->db->insert('qsubmit',$data);
    }
    public function update_submit_x($id_te,$id_qsub,$sub_an,$test_id,$sub_time)
    {
        $update_submit=array(
            'sub_an'=>$sub_an,
            'sub_time'=>$sub_time

        );
        $updatesubmit=$this->db->update('qsubmit',$update_submit,array('id_te'=>$id_te,'id_qsub'=>$id_qsub,'test_id'=>$test_id));
        return $updatesubmit;

    }
}
?>
